<template>
	<view>
		<view style="width: 100%">
			<view class="fenlei_title">
				<view class="fenlei_h">院系：</view>
				<view class="fenlei_is_css" @click="acti_click1">{{fenlei_is1?fenlei_is1:'请选择院系'}}</view>
				<w-picker mode="selector" :default-props="activity_type" default-type="name"
					@confirm="onTypeConfirm1($event)" ref="activity_is1" :options="depaList2"></w-picker>
			</view>

			<view class="fenlei_title">
				<view class="fenlei_h">专业：</view>
				<view class="fenlei_is_css" @click="acti_click2">{{fenlei_is2?fenlei_is2:'请选择专业'}}</view>
				<w-picker mode="selector" :default-props="activity_type" default-type="name"
					@confirm="onTypeConfirm2($event)" ref="activity_is2" :options="profList2"></w-picker>
			</view>

			<view class="fenlei_title">
				<view class="fenlei_h">级别：</view>
				<view class="fenlei_is_css" @click="acti_click3">{{fenlei_is3?fenlei_is3:'请选择级别'}}</view>
				<w-picker mode="selector" :default-props="activity_type" default-type="name"
					@confirm="onTypeConfirm3($event)" ref="activity_is3" :options="gradeList2"></w-picker>
			</view>

			<view class="fenlei_title">
				<view class="fenlei_h">班级：</view>
				<view class="fenlei_is_css" @click="acti_click4">{{fenlei_is4?fenlei_is4:'请选择级别'}}</view>
				<w-picker mode="selector" :default-props="activity_type" default-type="name"
					@confirm="onTypeConfirm4($event)" ref="activity_is4" :options="clazzList2"></w-picker>
			</view>

				<view class="but_css" @click="getTermWorkScoreList" type="danger">查询</view>
			</view>
			<view class="list_end_css" v-for="(item,index) in tableData" :key="index">
				<view class="list_p">序号：{{index+1}}</view>
				<view class="list_p">学期作业名称：{{item.termWorkName}}</view>
				<view class="list_p">姓名：{{item.stuName}}</view>
				<view class="list_p">院系：{{item.depa}}</view>
				<view class="list_p">专业：{{item.prof}}</view>
				<view class="list_p">级别：{{item.grade}}</view>
				<view class="list_p">班级：{{item.className}}</view>
				<view class="list_p">成绩：{{item.score}}</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
				fenlei_is1: '',
				fenlei_is2: '',
				fenlei_is3: '',
				fenlei_is4: '',
				fenlei_is5: '',
				activity_type: {
					"label": "name",
					"value": "id"
				},

				tableData: [], // 任务成绩列表
				depaList2: [],
				selectedDepa2: "",
				selectedProf2: "",
				selectedGrade2: "", // 选中的年级
				selectedClazz2: "", // 选中的班级

				profList2: [], // 教师的专业列表
				gradeList2: [], // 教师的级别列表
				clazzList2: [], // 班级列表
				termWorkName: "",

				pageNo: 1,
				pageSize: 10,
				total: 0
			};
		},
		created() {
			this.getAllDepaList();
			this.getTermWorkScoreList();
		},
		
		onReachBottom() {
			console.log('[]',"sadadad")
			this.pageNo +=1
			this.getTermWorkScoreList();
		},
		methods: {
			acti_click1() {
				this.$refs.activity_is1.show();
			},
			onTypeConfirm1(val) {
				this.fenlei_is1 = val.result
				this.selectedDepa2 = val.result
				this.selectDepa2(val.result)
			},
			acti_click2() {
				this.$refs.activity_is2.show();
			},
			//专业
			onTypeConfirm2(val) {
				this.fenlei_is2 = val.result
				this.selectedProf2 = val.result
				this.selectProf2(val.result)
			},
			acti_click3() {
				this.$refs.activity_is3.show();
			
			},
			onTypeConfirm3(val) {
				this.fenlei_is3 = val.result
				this.selectedGrade2 = val.result
				this.selectGrade2(val.result)
			},
			acti_click4() {
				this.$refs.activity_is4.show();
			},
			onTypeConfirm4(val) {
				this.fenlei_is4 = val.result
				this.selectedClazz2 = val.value
				this.selectClazz2()
			},
			
			tScoreTaskedExportExcel(element, title) {
				this.pageSize = 999999;
				this.getTermWorkScoreList();
			},
			getTermWorkScoreList() {
				const {
					pageNo,
					pageSize,
					selectedDepa2,
					selectedProf2,
					selectedGrade2,
					selectedClazz2,
					termWorkName
				} = this;
				this.pyReq(
					this.$http.getTermWorkScoreList, {
						pageNo,
						pageSize,
						depa: selectedDepa2,
						prof: selectedProf2,
						grade: selectedGrade2,
						classId: selectedClazz2,
						termWorkName
					},
					(res) => {
						console.log('res',res)
						if (res.code == 0) {
							this.tableData = this.tableData.concat(res.result.records);
						} else {
							uni.showToast({
								title:res.msg,
							})
						}
					}
				);
			},
			initScoreList() {},

			// 选择班级2
			selectClazz2() {},
			// 选择院系2
			selectDepa2(val) {
				let that = this;
				that.selectedProf2 = "";
				that.selectedGrade2 = "";
				that.selectedClazz2 = "";
				// that.checkedClazzList=[];//选中的班级
				that.clazzList2 = []; // 班级列表
				if (val == "选课") {
					that.fenlei_is1 = "选课";
					that.fenlei_is2 = "选课";
					that.fenlei_is3 = "选课";
					that.fenlei_is4 = "选课";
					
					that.profList2[0] = "选课";
					that.selectedProf2 = "选课";
					that.selectedGrade2 = "选课";
					that.profList2 = [];
					that.gradeList2 = [];
					this.getAllClazzList2("选课", "选课", "");
				} else {
					that.getAllProfList2(that.selectedDepa2);
					this.getAllClazzList2(
						this.selectedDepa2,
						this.selectedProf2,
						this.selectedGrade2
					);
				}
			},
			// 获取教师班级的专业2
			getAllProfList2(depa) {
				let that = this;
				that.pyReq(that.$http.getAllProfList, {
					depa: depa
				}, (res)=> {
					res.result.forEach((item, index) => {
						that.profList2.push({
							'name': item,
							'id': index,
						})
					});
				});
			},

			// 选择专业2
			selectProf2(val) {
				this.getAllClazzList2(
					this.selectedDepa2,
					this.selectedProf2,
					this.selectedGrade2
				);
				this.getAllGradeList2(this.selectedDepa2, this.selectedProf2);
				this.selectedGrade = "";
			},
			// 选择年级2
			selectGrade2(val) {
				this.getAllClazzList(
					this.selectedDepa2,
					this.selectedProf2,
					this.selectedGrade2
				);
			},

			// 根据教师和专业列出所有班级2
			getAllClazzList2(depa, prof, grade) {
				let that = this;
				that.pyReq(
					that.$http.getAllClazzList, {
						depa: depa,
						prof: prof,
						grade: grade
					},
					(res)=> {
						res.result.forEach((item, index) => {
							that.clazzList2.push({
								'name': item.clazzName,
								'id': item.classId,
							})
						});
					}
				);
			},

			// 根据教师和专业列出所有班级
			getAllClazzList(depa, prof, grade) {
				let that = this;
				that.pyReq(
					that.$http.getAllClazzList, {
						depa: depa,
						prof: prof,
						grade: grade
					},
					(res)=> {
						
						res.result.forEach((item, index) => {
							that.clazzList2.push({
								'name': item.clazzName,
								'id': item.classId,
							})
						});
					}
				);
			},

			// 获取教师选择的年级2
			getAllGradeList2(depa, prof) {
				let that = this;
				that.pyReq(
					that.$http.getAllGradeList, {
						depa: depa,
						prof: prof
					},
					(res)=> {
						console.log('----',res.result)
						res.result.forEach((item, index) => {
							that.gradeList2.push({
								'name': item,
								'id': index,
							})
						});
					}
				);
			},

			// 获取所有院系
			getAllDepaList() {
				let that = this;
				that.pyReq(that.$http.getAllDepaList, {}, (res)=> {
					res.result.forEach((item, index) => {
						that.depaList2.push({
							'name': item,
							'id': index,
						})
					});
				});
			},

			// 获取任务成绩列表2
			tScoreTaskedPageChange2(val) {
				this.pageNo = val;
				this.getTermWorkScoreList();
			},
			// 每页行数发生变化2
			tScoreTaskedPageSizeChange2(val) {
				this.pageSize = val;
				this.getTermWorkScoreList();
			}
		}
	};
</script>

<style>
	.list_end_css{
		border: 1px solid #B31610;
		border-radius: 7px;
		margin: 5px;
		padding: 8px;
	}
	.but_css{
		background-color: rgb(166, 14, 10);
		margin: 10px auto;
		width: 100px;
		border-radius: 7px;
		color: #fff;
		line-height: 30px;
		text-align: center;
		font-size: 15px;
	}
	.shangchuan_css{
		background-color: rgb(166, 14, 10); 
		margin: 10px auto;
		width: 100px;
		border-radius: 7px;
		color: #fff;
		line-height: 30px;
		text-align: center;
		font-size: 15px;
	}
	.xuanze_css{
		width: auto;flex: 1;border: 1px solid #ddd;padding-left: 5px;
		height: 30px;
	}
	.radio_css {
		margin: 10px;
	}
	
	/deep/.uni-radio-input-checked {
		color: #B31610;
		background-color: #B31610 !important;
		border-color: #B31610 !important;
	}
	
	/deep/.uni-radio-input-checked::before {
		background-color: #B31610;
		color: #B31610;
	}
	
	.timu_css {
		line-height: 30px;
		font-size: 15px;
	}
	
	.timu_css_sed {
		display: flex;
		justify-content: space-between;
	}
	
	.timu_css_sed input {
		border: 1px solid #ddd;
		border-radius: 7px;
		width: 80%;
		padding-left: 5px;
		height: 30px;
	}
	
	.fenlei_title {
		padding: 0 5px;
		display: flex;
		justify-content: space-between;
	}
	
	.fenlei_h {
		font-size: 15px;
		line-height: 25px;
		margin-top: 5px;
		text-align: center;
	}
	
	.fenlei_h b {
		color: #B31610;
	}
	
	.fenlei_is_css {
		overflow: hidden;
		width: 80%;
		line-height: 25px;
		border: 1px solid #ddd;
		border-radius: 7px;
		padding-left: 5px;
		margin-top: 5px;
		height: 27px;
	}
	
	.exam-container {
		border: 1px solid #eee;
		border-radius: 10px;
		padding: 5px;
		width: 90%;
		margin: 5px auto;
	}
	
	.exam-list {
		text-align: left;
	}
	
	.exam-item {
		margin-bottom: 30px;
	
	
	}
	
	.exam-item-options,
	.exam-item-answers {
		display: flex;
		align-items: center;
	}
	
	.exam-item-answers {
		margin-top: 10px;
	}
	
	.exam-item-option {
		flex: 1;
		display: flex;
		align-items: center;
		font-size: 16px;
		font-weight: bold;
		margin-bottom: 10px;
	}
	
	.exam-item-title {
		font-weight: bolder;
		font-size: 16px;
	}
	
	.exam-checkbox-group {
		display: flex;
		align-items: center;
	}
	
	.exam-checkbox {
		margin-right: 30px;
		width: 50px;
	
	
	}
	
	.el-checkbox__label {
		padding: 0;
	}
	
	.exam-radio-group {
		margin-left: -10px;
		display: flex;
		align-items: center;
	}
	
	.exam-radio {
		margin-right: 30px;
		width: 50px;
	}
</style>
